﻿using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using MvcApplication1.Models;
using Framework.Model;
using Ninject;
using Framework.Extensions;

namespace MvcApplication1.Controllers
{
    public class ContentController : Controller
    {
        [Inject]
        public Repository Repository { get; set; }

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Scene(int sceneId)
        {
            var panels = Repository.Find<Panel>(p => p.Scene.Id == sceneId).ToList().OrderBy(p => p.Order);
            var content = panels.Select(p => "<div>Panel " + p.Order + "</div><div>" + p.Description.Replace("\r\n", "<br/>") + "</div>").SeparateBy("<br/>\r\n");
            return new ContentResult {Content = content};
        }

        public class IndexData
        {
            public IEnumerable<ContentImage> Images { get; set; }
            public IEnumerable<Story> Stories { get; set; }
        }

        public ActionResult About()
        {
            return View();
        }
    }
}